package Task11;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String str = "";
        while (n > 0){
            str += (n % 2);
            n /= 2;
        }
//        System.out.println(str);
//        System.out.println(str.length());
        int countmin = 0;
        int countmax = 0;
        for (int i = 0; i < str.length(); i++) {
            if(str.charAt(i) == '1'){
                countmin++;
            }else{
                if(countmin >= countmax){
                    countmax = countmin;
                }
                countmin = 0;
            }
        }
        if(countmin >= countmax){
            countmax = countmin;
        }
        System.out.println(countmax);
    }
}
